/* 
 * File:   Detector.h
 * Author: liuyi
 *
 * Created on July 21, 2009, 3:13 PM
 */

#ifndef _DETECTOR_H
#define	_DETECTOR_H

#include "header.h"

#include <vector>

using namespace std;

class Detector {
public:
    static const int s_EDGE_THETA = 50;
    
    typedef struct roi {
        uchar *data;
        int width;
        int height;
    } ROI;
    
    static void detect(vector<ROI *> &roiList, const uchar *greyData, int width, int height);
    
private:
    static const int s_INTERVAL = 7;

    static const int s_WIN_SIZE = 45;

    enum EDGE{ ISEDGE = CHAR, NOTEDGE = BG};
    
    static int countJump(const uchar *data, int width, int height, int offset, uchar *buffer);

    static bool isPotential(const uchar *greyData, int len, uchar *buffer);

    static void fetchSubtitle(const uchar *greyData, int width, int height, vector<int> &start2end);

    Detector();
    virtual ~Detector();
    
};

#endif	/* _DETECTOR_H */

